package com.maotouying.owlsmart.SmartUtil.md5;

import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Properties;

/**
 * @description:
 * @author: mingtai
 * @createDate: 11:30 2020/3/11
 * @version: 1.0
 */

public class PropertiesUtil {

    //private static Logger logger = LoggerFactory.getLogger(PropertiesUtil.class);

    private static Properties props;

    static {
        String fileName = "owl.properties";
        props = new Properties();
        try {
            props.load(new InputStreamReader(PropertiesUtil.class.getClassLoader().getResourceAsStream(fileName), "UTF-8"));
        } catch (IOException e) {
            //logger.error("读取配置文件异常", e);
        }
    }

    public static String getProperty(String key) {
        String value = props.getProperty(key.trim());
        if (value.equals("")) {
            return null;
        }
        return value.trim();
    }

    public static String getProperty(String key, String defaultValue) {
        String value = props.getProperty(key.trim());
        if (value.equals("")) {
            value = defaultValue;
        }
        return value.trim();
    }


}



